#include <stdio.h>

#define SQUARES 64

int main(void)
{
    const double CROP = 2E16;
    double current, total;
    int count = 1;

    printf("square     grains       total        fraction of\n");
    printf("           added        grains       world total\n");

    total = current = 1;

    while (count <= SQUARES)
    {
        printf("%4d %15.2e %12.2e %12.2e\n", count, current, total, total / CROP);

        count += 1;
        current *= 2;
        total += current; 
    }
    printf("That's all.\n");

    return 0;
}